solve binary operations in modulos